package com.iretailer.report.mapper;


import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.iretailer.report.base.SuperMapper;
import com.iretailer.report.model.User;
import com.iretailer.report.model.UserRole;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @Auther: xjw
 * @Date: 2019/1/21 13:24
 * @Description:
 */
public interface UserMapper extends SuperMapper<User> {

    List<User> selectUserByUserCode(@Param("userCode") String userCode);

    int updateLock(@Param("id") String userId, @Param("isLock") Integer isLock, @Param("lockTime") LocalDateTime lockTime);

    void updateTryTimes(@Param("id") String userId, @Param("tryTimes") int tryTimes);

    List<User> selectAllOrderByName();

    List<User> selectUsersByRoleIds(List<String> roles);

    /**
     * 根据 parentId 的集合查询
     */
    List<User> selectUsersByparentIds(@Param("parentIds") List<String> parentIds, @Param("userQuery") User userQuery);

    List<User> selectUserPage(Page<User> page, @Param("ew") QueryWrapper wrapper);

    int updatePwd(@Param("id") String id, @Param("password") String password, @Param("updateUser") String updateUser, @Param("updateTime") LocalDateTime updateTime);

    IPage<UserRole> selectPageUserRoleMallIds(Page page, @Param("ew") QueryWrapper wrapper);

    List<UserRole> selectUserRole(@Param("ew") Wrapper wrapper);
}


